import requests
from lxml import etree

base_url = "https://bbs.itheima.com/forum-425-1.html"
# 请求
response = requests.get(base_url)
# 编码
response.encoding = "utf-8"
# 节点
node = etree.HTML(response.text)
# 解析
titles = node.xpath("//th[@class='new forumtit']/a[@class='s xst']/text()")
# titles1 = node.xpath("//th[contains(@class,'forumtit')]/a[contains(@class,'xst')]/text()")
print(titles)
# print(titles1)
